<template>
	<view>
		<view class="head">
			<view class="box-l">
				<view class="box-t">
					商品显示货品可卖库存
				</view>
				<view class="box-b">
					商城中货品显示的库存为实际库存减去货数
				</view>
				</view>
			<view class="box-r">
				<view><switch :checked='it' @change="switch1Change"  /></view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			it:true,
			data:'',
			wx_stock_no_owe:''
		};
	},
	onLoad() {
		this.show()
	},
	methods: {
		switch1Change: function(e) {
			// console.log('switch1 发生 change 事件，携带值为', e.target.value);
		if(e.target.value==true){
			this.data=1
		}else{
			this.data=0
		}
			this.$ajax('api/v1.shop/wdSetting',{
			    act:'edit',
				wx_stock_no_owe:this.data
			       }).then((res)=>{
			      console.log(res);
			       }).catch(res=>{
			        console.log(Error);
			       })
		},
		show(){
			this.$ajax('api/v1.shop/wdSetting',{
	
			       }).then((res)=>{
					   // console.log(res);
			     if(res.result.wx_stock_no_owe==0){
					 this.it=false
				 }else{
					 this.it=true
				 }
			       }).catch(res=>{
			        console.log(Error);
			       })
		}
		
	}
};
</script>

<style lang="scss">
page {
	background-color: #f7f4f8;
}
switch{
      transform: scale(0.8);
}
.head {
	height: 157rpx;
	background-color: #ffffff;
	margin-top: 29rpx;
	padding: 30rpx 40rpx;
	display: flex;
	justify-content: space-between;
	font-size:32rpx;
	font-family:PingFang SC;
	font-weight:500;
	color:rgba(51,51,51,1);
	box-sizing: border-box;
	.box-b{
		font-size:28rpx;
		font-family:PingFang SC;
		font-weight:500;
	color: #666666;
	margin-top: 19rpx;
	}
}
</style>
